fix(batch): remove withFileMutationQueue dependency on host shim#36
Merged
Conversation
cf1f8e8 to
ebcb870
Compare
The OMP legacy-pi-coding-agent-shim does not re-export withFileMutationQueue, so importing it from @earendil-works/pi-coding-agent caused extension validation to fail when omp plugin install pi-agent-flow evaluated dist/index.js. Replace the host-provided helper with a local per-file mutation queue in src/batch/execute.ts. This preserves the original serialization semantics (concurrent mutations on the same path are queued) while removing the symbol that the host shim is missing. Also drop the now-unused declaration from src/ambient.d.ts.
Add deterministic tests for the new local mutation queue helper: - single operation runs immediately - concurrent operations on the same path are serialized - operations on different paths run concurrently - queue continues after a failed operation Export withFileMutationQueue from execute.ts so the tests can import it directly.
ebcb870 to
8884d66
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Case summary:
pi-agent-flow install: case summaryWhen running
omp plugin install pi-agent-flow, the OMP PluginManager evaluates the publisheddist/index.jsduring post-install extension validation. That evaluation failed with:The root cause is that
pi-agent-flowimportswithFileMutationQueuefrom@earendil-works/pi-coding-agent, and OMP's legacy-pi compat layer rewrites that specifier onto its bundled shim. The current OMP shim does not re-exportwithFileMutationQueue, so dynamic evaluation throws before the extension factory is reachable, triggering the install rollback.Fix
withFileMutationQueuewith a local per-file mutation queue insrc/batch/execute.ts. This preserves the original concurrency semantics (mutations targeting the same path are serialized across concurrent calls) while removing the dependency on a symbol the host shim lacks.withFileMutationQueuedeclaration fromsrc/ambient.d.ts.Tests
Added
tests/mutation-queue.test.tscovering the new local helper:Verification
npm run lint✓npm run check:dist✓npm run test:trace-ui✓npm test✓dist/batch/execute.jsno longer importswithFileMutationQueuefrom@earendil-works/pi-coding-agent. The remaining runtime imports from that module (parseFrontmatter,DynamicBorder,createBashToolDefinition,DEFAULT_MAX_BYTES,DEFAULT_MAX_LINES,truncateHead,getMarkdownTheme) are still provided by the OMP legacy shim.Scope
This is the author-fix path from the case summary (option 2). It makes the current release installable against the current OMP build without requiring an upstream OMP re-sync.
Closes the install failure case for
pi-agent-flow@2.3.8.